package cn.zebra.dev.admin.module.menu.entity;

import cn.zebra.dev.base.module.menu.entity.BaseMenu;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 后台菜单管理
 *
 * @author runnable
 * @date 2019-09-07 16:59:45
 */
@TableName("admin_menu")
@Getter
@Setter
@ToString
public class AdminMenuEntity implements BaseMenu, Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @ApiModelProperty(hidden = true)
    private Long id;

    @ApiModelProperty("父菜单ID，一级菜单为0")
    @NotNull(message = "上级菜单不能为空")
    private Long parentId;

    @ApiModelProperty("父订单名")
    @TableField(exist = false)
    private String parentName;

    @ApiModelProperty("菜单名称")
    @NotBlank(message = "菜单名称不能为空")
    private String menuName;

    @ApiModelProperty("菜单URL")
    private String url;

    @ApiModelProperty("授权(多个用逗号分隔，如：user:list,user:create)")
    private String permission;

    @ApiModelProperty("类型   0：目录   1：菜单   2：按钮")
    private Integer menuType;

    @ApiModelProperty("菜单图标")
    private String icon;

    @ApiModelProperty("排序")
    private Long sort;

    @ApiModelProperty(hidden = true)
    private Boolean deleteFlag;

    @ApiModelProperty(hidden = true)
    private Long createId;

    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(hidden = true)
    private Long updateId;

    private LocalDateTime updateTime;

    @TableField(exist = false)
    @ApiModelProperty("子菜单列表")
    private List<AdminMenuEntity> children;

    @TableField(exist = false)
    private Boolean open;
}
